Uec3.EmployeeLoginHistoryWindow = Ext.extend(Ext.app.Module, {
			id : 'employeeLoginHistory',
			type : 'common/employeeLoginHistory', 

			/**
			 * Initialize this module. This function is called at startup (page
			 * load/refresh).
			 */
			init : function(initParams) {

			},
			paramsCollection : new Ext.util.MixedCollection(true),

			getParamsByKey : function(key) {

				return this.paramsCollection.get(key);
			},
			getComponents : function(params) {

				var loginHistory_ds;
				var loginHistory_grid;

				Ext.data.Store.prototype.applySort = function() {

					if (this.sortInfo && !this.remoteSort) {

						var s = this.sortInfo, f = s.field;
						var st = this.fields.get(f).sortType;
						var fn = function(r1, r2) {

							var v1 = st(r1.data[f]), v2 = st(r2.data[f]);
							if (typeof(v1) == "string") {

								return v1.localeCompare(v2);
							}
							return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);

						}
						this.data.sort(s.direction, fn);

						if (this.snapshot && this.snapshot != this.data) {

							this.snapshot.sort(s, direction, fn);

						}

					}

				};

				var getAndRestoreLoginHistory = function() {

					var userId = "";

					if (params && params.id) {

						userId = params.id;

					}

					loginHistory_ds = new Ext.data.Store({
								// proxy: new Ext.data.MemoryProxy(myData),
								proxy : new Ext.data.HttpProxy({
											url : Uec3.App.Constants.homeUrl
													+ '/user/findLoginHistory!queryOther.do'
										}),
								baseParams : {
									start : 0,
									limit : 20,
									userId : userId
								},
								reader : new Ext.data.JsonReader({
											totalProperty : 'totalProperty',
											root : 'root'
										}, [

										{
													name : 'id'
												}, {
													name : 'userId'
												}, {

													name : 'userName'
												},

												{
													name : 'gmtlogin',
													type : 'string'
												}, {
													name : 'ip'
												}

										]),
								remoteSort : true,

								// 默认排序字段
								sortInfo : {
									field : "gmtlogin",
									direction : "desc"
								}

							});

				};

				var componentInitsloginHistory = function() {

					// 初始化loginHistory表格对象

					var loginHistory_colModel = new Ext.grid.ColumnModel([
							new Ext.grid.RowNumberer(), {
								header : "用户名",
								width : 60,
								dataIndex : 'userName'
							},

							{
								header : "登入时间",
								width : 60,
								dataIndex : 'gmtlogin'
							}, {
								header : "IP地址",
								width : 80,
								dataIndex : 'ip',
								sortable : true
								
							}]);

					// create the Grid
					loginHistory_grid = new Ext.grid.GridPanel(

					{
								// title:'用户登入记录',
								region : 'center',
								iconCls : 'icon-grid',
								enableColumnMove : false,
								enableColumnMoveResize : false,
								stripeRows : true,
								height : 500,
								width : '100%',
								loadMask : {
									msg : "...加载数据中"
								},
								store : loginHistory_ds,
								cm : loginHistory_colModel,
								sm : new Ext.grid.RowSelectionModel({
											singleSelect : true
										}),
								viewConfig : {
									forceFit : true,
									columnsText : '显示的列',
									scrollOffset : 30,
									sortAscText : '升序',
									sortDescText : '降序'
								},
								bbar : new Ext.PagingToolbar({
											pageSize : 20,
											store : loginHistory_ds,
											display : true,
											displayInfo : true,
											displayMsg : '第 {0} - {1} 条  共 {2} 条',
											emptyMsg : "没有记录",
											items : [/**
														 * '-', { pressed: true,
														 * enableToggle:true,
														 * text: 'Show Preview',
														 * cls: 'x-btn-text-icon
														 * details',
														 * toggleHandler:
														 * function(btn,
														 * pressed){ var view =
														 * loginHistory.getView();
														 * view.showPreview =
														 * pressed;
														 * view.refresh(); } }
														 */
											]
										})

							});

					loginHistory_ds.load();

				};

				var controlLoginHistoryEvent = function() {
				};

				getAndRestoreLoginHistory();

				componentInitsloginHistory();

				controlLoginHistoryEvent();
				this.paramsCollection.add("loginHistory_ds",loginHistory_ds);
				return loginHistory_grid;

			},
			initEvent:function(){
				var module=this;
				var win=module.getParamsByKey("win");
				win.on('show',function(){
					this.getParamsByKey("loginHistory_ds").load({
						 callback: function(records,options,success){
				         
				         if(success){
				        	 
				        	// Ext.Msg.alert('提示',"加载数据成功");
				         }else{
				        	 
				        	 
				        	 Ext.Msg.alert('提示',"网络连接异常...请稍候再试");
				         }			  
					
				 }		
			
			});
				},module,{single:true});
			},
			/**
			 * Create this modules window here.
			 */
			createWindow : function(params) {
				var windowId = 'loginHistory';
				if (params) {
					windowId += "_" + params.winId;
				}
				var module = this;
				var desktop = this.app.getDesktop();
				var win = desktop.getWindow('employeeLoginHistory');
				if (!win) {
					win = desktop.createWindow({
								id : 'employeeLoginHistory',
								title : '员工登入日志列表',
								width : document.body.clientWidth * 0.9,
								height : document.body.clientHeight * 0.9,
								autoScroll : true,
								iconCls : 'acc-icon',
								shim : false,
								animCollapse : false,
								constrainHeader : true,
								maximizable : true,
								taskbuttonTooltip : "员工登入日志列表",
								layout : "fit",
								listeners : {
									'resize' : function(win, width, height) {
										if (width < 800 || height < 500) {
											win.setWidth(800);
											win.setHeight(500);
											this.items.get(0).setHeight(500);
										} else {
											this.items.get(0).setHeight(height);
										}
									}
								},
								tools : [{
											id : 'refresh',
											handler : Ext.emptyFn,
											scope : this
										}],
								items : [this.getComponents(params)]
							});
					module.paramsCollection.add("win",win);
					module.initEvent();

				}
				win.show();

			}
		});